package com.test.resumeanalysis.ui.home.post_info

import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.navigation.fragment.findNavController
import com.test.resumeanalysis.common.BaseVBFragment
import com.test.resumeanalysis.data.model.JobInfo
import com.test.resumeanalysis.databinding.FragmentPostInfoBinding
import com.test.resumeanalysis.ui.talent.TalentAdapter
import com.test.resumeanalysis.viewModel.PublicViewModel


class PostInfoFragment : BaseVBFragment<FragmentPostInfoBinding>(FragmentPostInfoBinding::inflate){

    //注意这里是 activityViewModels 就代表这个viewmodel是整个activity的所有组件共享
    private val model: PublicViewModel by activityViewModels()

    private lateinit var adapter: TalentAdapter

    override fun initView() {
        super.initView()


        setupToolbar(binding.postInfoToolbar,true)

        binding.postInfoToolbar.setNavigationOnClickListener{
            findNavController().popBackStack()
        }

        model.selectedPost.observe(viewLifecycleOwner, Observer<JobInfo> {
            binding.tvTitle.text = it.jobname
            binding.tvDutyInfo.text  = it.responsibility
//            binding.tvWages.text = it.wages
            binding.tvRequireInfo.text = it.requirement
        });

    }

}